"use strict";

module.exports = {
  up: (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM, TEXT } = Sequelize;
    return queryInterface.createTable("score", {
      id: {
        type: INTEGER(20),
        primaryKey: true,
        autoIncrement: true,
      },
      order_id: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: "成绩单id"
      },
      user_id: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: "用户id"
      },
      class_id: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: "班级id"
      },
      branch_id: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: "学科id"
      },
      score: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: "分数",
      },
      image: {
        type: STRING,
        allowNull: true,
        defaultValue: "",
        comment: "附件",
      },
      comment: {
        type: STRING,
        allowNull: true,
        defaultValue: "",
        comment: "评论",
      },
      status: {
        type: INTEGER(1),
        allowNull: false,
        defaultValue: 0,
        comment: "状态 0取消 1正常",
      },
      created_time: DATE,
      updated_time: DATE,
    });
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable("score");
  },
};